/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ages.graphics

import javax.media.opengl.GL

case class Sprite(filename:String,rows:Int,cols:Int,hue:Float){
  
  var spriteBuffer:SpriteBuffer =_
  var loaded = false
  var displayLists = new Array[Array[Int]](0,0)

  def this(filename:String,rows:Int,cols:Int) = this(filename,rows,cols,1)
  SpriteBufferManager.enqueueSprite(this)

  def drawWithoutDisplaylist(gl:GL,row:Int, col:Int){
    if(loaded)
      spriteBuffer.drawWithoutDisplaylist(gl,row,col)
  }

  def bind(){
    if(loaded)
      spriteBuffer.spriteSheet.bind
    }

  def generateDisplaylists(gl:GL)
  {
    val dm = new SpriteBufferManager(gl)
    dm.getDisplaylist(spriteBuffer)
  }

  def forceBuffer()
  {

  }

}
